package com.xgkj.diyiketang.util;

import android.content.Context;
import android.widget.AbsListView;
import android.widget.BaseAdapter;

import com.handmark.pulltorefresh.library.PullToRefreshAdapterViewBase;
import com.handmark.pulltorefresh.library.PullToRefreshGridView;

/**
 * Created by windo on 16/4/22.
 */
public abstract class MyCustomAdapter extends BaseAdapter implements AbsListView.OnScrollListener{
    protected Context mContext;
    protected AbsListView mListView;
    protected boolean isScrolling;
    public MyCustomAdapter(Context context, AbsListView listView) {
        mContext = context;
        listView.setOnScrollListener(this);
    }

    public MyCustomAdapter(Context context, PullToRefreshGridView listview) {
        mContext = context;
        listview.setOnScrollListener(this);
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {
        switch (scrollState){
            case SCROLL_STATE_FLING:
            case SCROLL_STATE_TOUCH_SCROLL:
                isScrolling = true;
                break;
            case SCROLL_STATE_IDLE:
                isScrolling = false;
                notifyDataSetChanged();
                break;
        }
    }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

    }
}
